<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-mobile',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'mobile\controllers',
    'components' => [
        'request' => [
            'csrfParam' => '_csrf_mobile',
//            'enableCookieValidation' => false ,
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity_mobile', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the mobile
            'name' => 'advanced-mobile',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning', 'info'],
                    'maxFileSize' => 1024,
                    'maxLogFiles' => 10,
                ],
                [
                    'class' => 'yii\log\DbTarget',
                    'levels' => ['error'],
                    'except' => [
                        'yii\web\HttpException:404',
                    ],
                ],
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error'],
                    'logFile' => '@app/runtime/logs/error.log',
                    'maxFileSize' => 1024 * 2,
                    'maxLogFiles' => 50,
                ],
                [
                    'class' => 'yii\log\DbTarget',
                    'levels' => ['info'],
                    'categories' => ["curlPost_info","curlGet_info"],
                    'except' => [
                        'yii\web\HttpException:404',
                    ],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'tip/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'suffix' => '.html',
            'cache' => 'fileCache', //缓存类别，使用文件缓存。防止报错。
            'rules' => [
                "<controller:\w+>/<action:\w+>" => "<controller>/<action>"
            ],
        ],
    ],
    'params' => $params,
    'language'=>'zh-CN',               //这个配置别漏了，选择中文语言包
];
